<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Implications</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Implications' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../inform7n.html">Inform7</a></li><li><a href="index.html">assertions</a></li><li><a href="index.html#4">Chapter 4: Assertions</a></li><li><b>Implications</b></li></ul></div>
<p class="purpose">To keep track of a dangerous form of super-assertion called an implication, which is allowed to generalise about properties.</p>

<ul class="toc"><li><a href="4-imp.html#SP1">&#167;1. Creation</a></li><li><a href="4-imp.html#SP4">&#167;4. Implication checking</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Creation.</b>Implications are structures are used to store the information in sentences
like "Something worn is usually wearable and initially carried." The
"something worn" part must turn out to be a description of a category of
objects; the "usually" part translates into a level of certainty. We regard
these as implications in the sense of IF condition A, THEN condition B, but
note that A is quite restricted in what it can be: it must be a simple-to-test
description only, whereas B could be any subtree of an assertion.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">implication</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">pcalc_prop</span><span class="plain-syntax"> *</span><span class="identifier-syntax">if_proposition</span><span class="plain-syntax">; </span><span class="comment-syntax"> which objects are affected</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">then_pn</span><span class="plain-syntax">; </span><span class="comment-syntax"> what assertion is implied about them</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">where_declared</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">implied_likelihood</span><span class="plain-syntax">; </span><span class="comment-syntax"> with what certainty level</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">implication</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure implication is accessed in 6/rlb and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>We also need a little piece of storage attached to each property name:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">possession_marker</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">possessed</span><span class="plain-syntax">; </span><span class="comment-syntax"> temporary use when checking implications about objects</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">possession_certainty</span><span class="plain-syntax">; </span><span class="comment-syntax"> ditto</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">possession_marker</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure possession_marker is accessed in 8/tap and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>Implications are gathered during the main parse tree traverses, but all we do
is to store them and sit on them.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Assertions::Implications::new</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">Assertions::Implications::new</span></span>:<br/>Assertions - <a href="4-ass.html#SP6_3_2">&#167;6.3.2</a>, <a href="4-ass.html#SP6_3_22">&#167;6.3.22</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">px</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">py</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">prevailing_mood</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CERTAIN_CE</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="4-imp.html#SP3_1" class="named-paragraph-link"><span class="named-paragraph">Reject implications given with certainty</span><span class="named-paragraph-number">3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Node::get_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">py</span><span class="plain-syntax">) == </span><span class="identifier-syntax">AND_NT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><a href="4-imp.html#SP3" class="function-link"><span class="function-syntax">Assertions::Implications::new</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">px</span><span class="plain-syntax">, </span><span class="identifier-syntax">py</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="4-imp.html#SP3" class="function-link"><span class="function-syntax">Assertions::Implications::new</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">px</span><span class="plain-syntax">, </span><span class="identifier-syntax">py</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-imp.html#SP3_2" class="named-paragraph-link"><span class="named-paragraph">Actually create a single implication</span><span class="named-paragraph-number">3.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3_1" class="paragraph-anchor"></a><b>&#167;3.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Reject implications given with certainty</span><span class="named-paragraph-number">3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_ImplicationCertain</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="string-syntax">"that's an implication which is too certain for me"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"since a sentence like this talks about a generality of things in terms of "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"one either/or property implying another, and I can only handle those as "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"likelihoods. You should probably add 'usually' somewhere: e.g., 'An open "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"door is usually openable'. (But implications can have unpredictable "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"consequences: best to avoid them altogether where possible.)"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-imp.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_2" class="paragraph-anchor"></a><b>&#167;3.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Actually create a single implication</span><span class="named-paragraph-number">3.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">premiss_kind</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">pcalc_prop</span><span class="plain-syntax"> *</span><span class="identifier-syntax">premiss</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-imp.html#SP3_2_1" class="named-paragraph-link"><span class="named-paragraph">Find the premiss kind and specification</span><span class="named-paragraph-number">3.2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-imp.html#SP3_2_2" class="named-paragraph-link"><span class="named-paragraph">Check that the premiss involves only either/or properties and/or a kind</span><span class="named-paragraph-number">3.2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-imp.html#SP3_2_3" class="named-paragraph-link"><span class="named-paragraph">Check that the conclusion involves only a single either/or property</span><span class="named-paragraph-number">3.2.3</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">implication</span><span class="plain-syntax"> *</span><span class="identifier-syntax">imp</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">implication</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">imp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_proposition</span><span class="plain-syntax"> = </span><span class="identifier-syntax">premiss</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">imp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">then_pn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">py</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">imp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">implied_likelihood</span><span class="plain-syntax"> = </span><span class="identifier-syntax">prevailing_mood</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">imp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">where_declared</span><span class="plain-syntax"> = </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ADD_TO_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">imp</span><span class="plain-syntax">, </span><span class="reserved-syntax">implication</span><span class="plain-syntax">, </span><span class="identifier-syntax">InferenceSubjects::get_implications</span><span class="plain-syntax">(</span><span class="identifier-syntax">premiss_kind</span><span class="plain-syntax">));</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">IMPLICATIONS</span><span class="plain-syntax">, </span><span class="string-syntax">"Forming implication for $j: $D implies\n  $T"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">premiss_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">imp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_proposition</span><span class="plain-syntax">, </span><span class="identifier-syntax">imp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">then_pn</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-imp.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_2_1" class="paragraph-anchor"></a><b>&#167;3.2.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Find the premiss kind and specification</span><span class="named-paragraph-number">3.2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">loc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">px</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Node::get_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">loc</span><span class="plain-syntax">) == </span><span class="identifier-syntax">WITH_NT</span><span class="plain-syntax">) </span><span class="identifier-syntax">loc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">loc</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">premiss_kind</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_subject</span><span class="plain-syntax">(</span><span class="identifier-syntax">loc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">premiss</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_creation_proposition</span><span class="plain-syntax">(</span><span class="identifier-syntax">loc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">IF_MODULE</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">premiss_kind</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">premiss_kind</span><span class="plain-syntax"> = </span><span class="identifier-syntax">KindSubjects::from_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">K_thing</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">endif</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">ifndef</span><span class="plain-syntax"> </span><span class="identifier-syntax">IF_MODULE</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">premiss_kind</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">premiss_kind</span><span class="plain-syntax"> = </span><span class="identifier-syntax">KindSubjects::from_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">K_object</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">endif</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-imp.html#SP3_2">&#167;3.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_2_2" class="paragraph-anchor"></a><b>&#167;3.2.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Check that the premiss involves only either/or properties and/or a kind</span><span class="named-paragraph-number">3.2.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Assert::testable_at_compile_time</span><span class="plain-syntax">(</span><span class="identifier-syntax">premiss</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_BadImplicationDomain</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"that's an implication where the condition to qualify is not "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"one that I can determine in advance of the start of play"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"since it involves more than simple either/or properties "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"plus a kind. (For example, adjectives like 'adjacent' or "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"'visible' here are too difficult to determine.)"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-imp.html#SP3_2">&#167;3.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_2_3" class="paragraph-anchor"></a><b>&#167;3.2.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Check that the conclusion involves only a single either/or property</span><span class="named-paragraph-number">3.2.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">unary_predicate</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pred</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_predicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">py</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prn</span><span class="plain-syntax"> = </span><a href="8-aa.html#SP5" class="function-link"><span class="function-syntax">AdjectiveAmbiguity::has_either_or_property_meaning</span></a><span class="plain-syntax">(</span><a href="8-tap.html#SP4" class="function-link"><span class="function-syntax">AdjectivalPredicates::to_adjective</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pred</span><span class="plain-syntax">), </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">prn</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_ImplicationValueProperty</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"that's an implication where the outcome is an adjective other than "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"a simple either/or property"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"which is the only form of implication I can handle."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-imp.html#SP3_2">&#167;3.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. Implication checking.</b>The checking of implications happens all at once, during model completion,
so that all inferences arising directly from the source text have already
been drawn.
</p>

<p class="commentary">For instance, if there is an inference asserting that object X is worn, and
there is an implication that what is worn is usually also wearable, then we
must generate an inference that X is wearable: in effect, this is a deduction
from a syllogism. We should however not generate such an inference if we
already have definite knowledge that X is not wearable. We do this for each
object X individually.
</p>

<p class="commentary">We begin by checking implications associated with X and applying to X,
but in fact because <span class="extract"><span class="extract-syntax">Assertions::Implications::check_implications_of</span></span> recurses depth-first through
the kinds, a typical object X &mdash; a container, say &mdash; will first have
implications associated with "thing" applied to it, then with
those associated with "container", and only then its own implications.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Assertions::Implications::consider_all</span><span class="plain-syntax">(</span><span class="identifier-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">infs</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">KindSubjects::to_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">infs</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">ongoing</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ongoing</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="4-imp.html#SP4_1" class="named-paragraph-link"><span class="named-paragraph">Erase all of the possession markers</span><span class="named-paragraph-number">4.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><a href="4-imp.html#SP5" class="function-link"><span class="function-syntax">Assertions::Implications::set_possessed_flags</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">infs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ongoing</span><span class="plain-syntax"> = </span><a href="4-imp.html#SP6" class="function-link"><span class="function-syntax">Assertions::Implications::check_implications_of</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">infs</span><span class="plain-syntax">, </span><span class="identifier-syntax">infs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4_1" class="paragraph-anchor"></a><b>&#167;4.1. </b>We are going to need to examine which either/or properties are held by X.
We don't want to store all of the properties of everything in memory at once,
so we keep just a single set of "possession markers", one for each property.
Here we erase these markers ready for use with X.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Erase all of the possession markers</span><span class="named-paragraph-number">4.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">property</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">possession_marker</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pom</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Properties::get_possession_marker</span><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pom</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">possessed</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pom</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">possession_certainty</span><span class="plain-syntax"> = </span><span class="identifier-syntax">UNKNOWN_CE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-imp.html#SP4">&#167;4</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>This is the recursive routine which sets the possession markers for X on the
basis of the inferences so far drawn about it.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Assertions::Implications::set_possessed_flags</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">Assertions::Implications::set_possessed_flags</span></span>:<br/><a href="4-imp.html#SP4">&#167;4</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">infs</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InferenceSubjects::narrowest_broader_subject</span><span class="plain-syntax">(</span><span class="identifier-syntax">infs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">k</span><span class="plain-syntax">) </span><a href="4-imp.html#SP5" class="function-link"><span class="function-syntax">Assertions::Implications::set_possessed_flags</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">k</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">inference</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inf</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">KNOWLEDGE_LOOP</span><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">, </span><span class="identifier-syntax">infs</span><span class="plain-syntax">, </span><span class="identifier-syntax">property_inf</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PropertyInferences::get_property</span><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Properties::is_either_or</span><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">)) &amp;&amp; (</span><span class="identifier-syntax">Inferences::get_certainty</span><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">) != </span><span class="identifier-syntax">UNKNOWN_CE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="4-imp.html#SP5_1" class="named-paragraph-link"><span class="named-paragraph">See what we can get out of this inference</span><span class="named-paragraph-number">5.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5_1" class="paragraph-anchor"></a><b>&#167;5.1. </b>Note that where there are antonyms such as open/closed, we have to mark
both of them, because an inference of being closed is as good as an inference
of not being open, and vice versa.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">See what we can get out of this inference</span><span class="named-paragraph-number">5.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">truth_state</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">, </span><span class="identifier-syntax">certainty</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Inferences::get_certainty</span><span class="plain-syntax">(</span><span class="identifier-syntax">inf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">certainty</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) { </span><span class="identifier-syntax">certainty</span><span class="plain-syntax"> = -</span><span class="identifier-syntax">certainty</span><span class="plain-syntax">; </span><span class="identifier-syntax">truth_state</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">; }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">possession_marker</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pom</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Properties::get_possession_marker</span><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-imp.html#SP5_1_1" class="named-paragraph-link"><span class="named-paragraph">Mark this property if its possession is not already equally certainly known</span><span class="named-paragraph-number">5.1.1</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">EitherOrProperties::get_negation</span><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">prn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EitherOrProperties::get_negation</span><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pom</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Properties::get_possession_marker</span><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">truth_state</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">truth_state</span><span class="plain-syntax">)?</span><span class="identifier-syntax">FALSE:TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="4-imp.html#SP5_1_1" class="named-paragraph-link"><span class="named-paragraph">Mark this property if its possession is not already equally certainly known</span><span class="named-paragraph-number">5.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-imp.html#SP5">&#167;5</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_1_1" class="paragraph-anchor"></a><b>&#167;5.1.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Mark this property if its possession is not already equally certainly known</span><span class="named-paragraph-number">5.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pom</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">possession_certainty</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">certainty</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pom</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">possessed</span><span class="plain-syntax"> = </span><span class="identifier-syntax">truth_state</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pom</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">possession_certainty</span><span class="plain-syntax"> = </span><span class="identifier-syntax">certainty</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-imp.html#SP5_1">&#167;5.1</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b>Lastly, then, the routine actually checking and applying implications.
Our aim is to find and act upon the first implication which makes a difference,
and return <span class="extract"><span class="extract-syntax">TRUE</span></span>; but if no implication can be acted on, to return <span class="extract"><span class="extract-syntax">FALSE</span></span>.
</p>

<p class="commentary">This cannot act twice on the same candidate with the same implication, since
the act results in creating inferences about the property. An attempt at
repetition results in redundancy, since the inferences it would make have
no better a certainty level.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Assertions::Implications::check_implications_of</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">Assertions::Implications::check_implications_of</span></span>:<br/><a href="4-imp.html#SP4">&#167;4</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">domain</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">candidate</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InferenceSubjects::narrowest_broader_subject</span><span class="plain-syntax">(</span><span class="identifier-syntax">domain</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">k</span><span class="plain-syntax">) &amp;&amp; (</span><a href="4-imp.html#SP6" class="function-link"><span class="function-syntax">Assertions::Implications::check_implications_of</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">k</span><span class="plain-syntax">, </span><span class="identifier-syntax">candidate</span><span class="plain-syntax">))) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LinkedLists::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">InferenceSubjects::get_implications</span><span class="plain-syntax">(</span><span class="identifier-syntax">domain</span><span class="plain-syntax">)) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">IMPLICATIONS</span><span class="plain-syntax">, </span><span class="string-syntax">"Considering implications about $j as they apply to $j:\n"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">domain</span><span class="plain-syntax">, </span><span class="identifier-syntax">candidate</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">implication</span><span class="plain-syntax"> *</span><span class="identifier-syntax">imp</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">imp</span><span class="plain-syntax">, </span><span class="reserved-syntax">implication</span><span class="plain-syntax">, </span><span class="identifier-syntax">InferenceSubjects::get_implications</span><span class="plain-syntax">(</span><span class="identifier-syntax">domain</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="4-imp.html#SP6_1" class="named-paragraph-link"><span class="named-paragraph">Consider this individual implication as it applies to the candidate</span><span class="named-paragraph-number">6.1</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6_1" class="paragraph-anchor"></a><b>&#167;6.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Consider this individual implication as it applies to the candidate</span><span class="named-paragraph-number">6.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">unary_predicate</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pred</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_predicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">imp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">then_pn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">conclusion_state</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="8-tap.html#SP4" class="function-link"><span class="function-syntax">AdjectivalPredicates::parity</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pred</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="identifier-syntax">conclusion_state</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">imp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">implied_likelihood</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">conclusion_state</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">conclusion_state</span><span class="plain-syntax">)?</span><span class="identifier-syntax">FALSE:TRUE</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">IMPLICATIONS</span><span class="plain-syntax">, </span><span class="string-syntax">"$D =&gt; $T (certainty %d; changed state %d)\n"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">imp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_proposition</span><span class="plain-syntax">, </span><span class="identifier-syntax">imp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">then_pn</span><span class="plain-syntax">, </span><span class="identifier-syntax">imp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">implied_likelihood</span><span class="plain-syntax">, </span><span class="identifier-syntax">conclusion_state</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">conclusion_prop</span><span class="plain-syntax"> = </span><a href="8-aa.html#SP5" class="function-link"><span class="function-syntax">AdjectiveAmbiguity::has_either_or_property_meaning</span></a><span class="plain-syntax">(</span>
<span class="plain-syntax">        </span><a href="8-tap.html#SP4" class="function-link"><span class="function-syntax">AdjectivalPredicates::to_adjective</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pred</span><span class="plain-syntax">), </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-imp.html#SP6_1_1" class="named-paragraph-link"><span class="named-paragraph">Check that the conclusion is not impossible</span><span class="named-paragraph-number">6.1.1</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">possession_marker</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pom</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Properties::get_possession_marker</span><span class="plain-syntax">(</span><span class="identifier-syntax">conclusion_prop</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-imp.html#SP6_1_2" class="named-paragraph-link"><span class="named-paragraph">Check that the conclusion is not redundant or irrelevant</span><span class="named-paragraph-number">6.1.2</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">candidate_qualifies</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Assert::test_at_compile_time</span><span class="plain-syntax">(</span><span class="identifier-syntax">imp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_proposition</span><span class="plain-syntax">, </span><span class="identifier-syntax">candidate</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">candidate_qualifies</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">IMPLICATIONS</span><span class="plain-syntax">, </span><span class="string-syntax">"PASS: changing property $Y of $j\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">conclusion_prop</span><span class="plain-syntax">, </span><span class="identifier-syntax">candidate</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="4-imp.html#SP6_1_3" class="named-paragraph-link"><span class="named-paragraph">Apply the conclusion to the candidate</span><span class="named-paragraph-number">6.1.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">IMPLICATIONS</span><span class="plain-syntax">, </span><span class="string-syntax">"FAIL: take no action\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-imp.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_1_1" class="paragraph-anchor"></a><b>&#167;6.1.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Check that the conclusion is not impossible</span><span class="named-paragraph-number">6.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">conclusion_prop</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">PropertyPermissions::find</span><span class="plain-syntax">(</span><span class="identifier-syntax">candidate</span><span class="plain-syntax">, </span><span class="identifier-syntax">conclusion_prop</span><span class="plain-syntax">, </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">) == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">IMPLICATIONS</span><span class="plain-syntax">, </span><span class="string-syntax">"IMPOSSIBLE: property not provided\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-imp.html#SP6_1">&#167;6.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_1_2" class="paragraph-anchor"></a><b>&#167;6.1.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Check that the conclusion is not redundant or irrelevant</span><span class="named-paragraph-number">6.1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">IMPLICATIONS</span><span class="plain-syntax">, </span><span class="string-syntax">"Possession marker has (certainty %d; possessed state %d)\n"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pom</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">possession_certainty</span><span class="plain-syntax">, </span><span class="identifier-syntax">pom</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">possessed</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pom</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">possessed</span><span class="plain-syntax"> == </span><span class="identifier-syntax">conclusion_state</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">IMPLICATIONS</span><span class="plain-syntax">, </span><span class="string-syntax">"REDUNDANT: property already correct\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pom</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">possession_certainty</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CERTAIN_CE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">IMPLICATIONS</span><span class="plain-syntax">, </span><span class="string-syntax">"IRRELEVANT: property already settled\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-imp.html#SP6_1">&#167;6.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_1_3" class="paragraph-anchor"></a><b>&#167;6.1.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Apply the conclusion to the candidate</span><span class="named-paragraph-number">6.1.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">adjective</span><span class="plain-syntax"> *</span><span class="identifier-syntax">aph</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EitherOrProperties::as_adjective</span><span class="plain-syntax">(</span><span class="identifier-syntax">conclusion_prop</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">pcalc_prop</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prop</span><span class="plain-syntax"> = </span><span class="identifier-syntax">KindPredicates::new_atom</span><span class="plain-syntax">(</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">KindSubjects::to_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">domain</span><span class="plain-syntax">), </span><span class="identifier-syntax">Terms::new_variable</span><span class="plain-syntax">(0));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">conclusion_state</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">prop</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Propositions::concatenate</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop</span><span class="plain-syntax">, </span><span class="identifier-syntax">Atoms::new</span><span class="plain-syntax">(</span><span class="identifier-syntax">NEGATION_OPEN_ATOM</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">prop</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Propositions::concatenate</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop</span><span class="plain-syntax">, </span><a href="8-tap.html#SP2" class="function-link"><span class="function-syntax">AdjectivalPredicates::new_atom_on_x</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">aph</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">prop</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Propositions::concatenate</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop</span><span class="plain-syntax">, </span><span class="identifier-syntax">Atoms::new</span><span class="plain-syntax">(</span><span class="identifier-syntax">NEGATION_CLOSE_ATOM</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">prop</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Propositions::concatenate</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop</span><span class="plain-syntax">, </span><a href="8-tap.html#SP2" class="function-link"><span class="function-syntax">AdjectivalPredicates::new_atom_on_x</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">aph</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">imp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">where_declared</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Assert::true_about</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop</span><span class="plain-syntax">, </span><span class="identifier-syntax">candidate</span><span class="plain-syntax">, </span><span class="identifier-syntax">CERTAIN_CE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-imp.html#SP6_1">&#167;6.1</a>.</li></ul>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="4-ass2.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-am.html">1</a></li><li class="progresschapter"><a href="2-bv.html">2</a></li><li class="progresschapter"><a href="3-dlr.html">3</a></li><li class="progresscurrentchapter">4</li><li class="progresssection"><a href="4-nr.html">nr</a></li><li class="progresssection"><a href="4-rpt.html">rpt</a></li><li class="progresssection"><a href="4-tc.html">tc</a></li><li class="progresssection"><a href="4-ass.html">ass</a></li><li class="progresssection"><a href="4-npa.html">npa</a></li><li class="progresssection"><a href="4-pk.html">pk</a></li><li class="progresssection"><a href="4-rk.html">rk</a></li><li class="progresssection"><a href="4-ass2.html">ass2</a></li><li class="progresscurrent">imp</li><li class="progresschapter"><a href="5-id.html">5</a></li><li class="progresschapter"><a href="6-rls.html">6</a></li><li class="progresschapter"><a href="7-tc.html">7</a></li><li class="progresschapter"><a href="8-kpr.html">8</a></li><li class="progressnext"><a href="5-id.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

